//
//  HTAPICommonTools.h
//  CreditCommunity
//
//  Created by maiya on 2017/10/12.
//  Copyright © 2017年 maiya. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void ((^SuccessBlock)(id responseObject));
typedef void ((^FailureBlock)(id error));
typedef void ((^NetErrorBlock)(NSString *netError));

@interface HTAPICommonTools : NSObject
//网络请求地址
@property (nonatomic, copy) NSString *url;
//上传数据字典
@property (nonatomic, copy) NSDictionary *parameters;
//添加网络请求loading的View
@property (nonatomic, strong) UIView *showLoadingView;

//网络请求成功回调
@property (nonatomic, copy) SuccessBlock successBlock;
//网络失败回调
@property (nonatomic, copy) FailureBlock failureBlock;
//网络请求无网失败回调
@property (nonatomic, copy) NetErrorBlock netErrorBlock;



/**
 POST 网络请求
 
 @param url 请求接口
 @param parameters 请求参数
 @param successBlock 成功回调
 @param failureBlock 失败回调
 @param netErrorBlock 无网络回调
 */
+ (void)POST:(NSString *)url parameters:(id)parameters success:(SuccessBlock)successBlock failure:(FailureBlock)failureBlock netError:(NetErrorBlock)netErrorBlock;

/**
 GET 网络请求
 
 @param url 请求接口
 @param parameters 请求参数
 @param successBlock 成功回调
 @param failureBlock 失败回调
 @param netErrorBlock 无网络回调
 */
+ (void)GET:(NSString *)url parameters:(id)parameters success:(SuccessBlock)successBlock failure:(FailureBlock)failureBlock netError:(NetErrorBlock)netErrorBlock;

@end
